module.exports = app => {
  const { router, controller, middleware } = app;
  const { auth } = middleware;

  // 分页
  router.get('/roles/page', auth(), controller.role.list);
  // 下拉列表
  router.get('/roles/options', auth(), controller.role.options);
  // 获取角色信息
  router.get('/roles/:id/form', auth(), controller.role.roleForm);
  // 角色菜单
  router.get('/roles/:id/menuIds', auth(), controller.role.roleMenus);

  // 添加
  router.post('/roles', auth(), controller.role.save);

  // 修改角色菜单
  router.put('/roles/:id/menus', auth(), controller.role.saveRoleMenus);
  // 修改
  router.put('/roles/:id', auth(), controller.role.save);

  // 删除
  router.delete('/roles/:ids', auth(), controller.role.remove);
};
